package com.caiyigo.test.arithmetic.strategy;

import com.caiyigo.test.arithmetic.simplefactory.CashNormal;
import com.caiyigo.test.arithmetic.simplefactory.CashRebate;
import com.caiyigo.test.arithmetic.simplefactory.CashReturn;
import com.caiyigo.test.arithmetic.simplefactory.CashSuper;

public class CashContext {
	private CashSuper cSuper = null;

	public CashContext(String type) {
		switch (type) {
		case "正常收费":
			cSuper = new CashNormal();
			break;
		case "满300返100":
			CashReturn cr = new CashReturn("300", "100");
			cSuper = cr;
			break;
		case "打8折":
			CashRebate cr2 = new CashRebate("0.8");
			cSuper = cr2;
			break;
		default:
			break;
		}
	}

	public double GetResult(double money) {
		return cSuper.acceptCash(money);
	}
}
